package com.apes.fn.business.fixedLoss.modle;

import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.Model;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import com.apes.framework.plugin.soe.annotations.State;
import com.apes.framework.plugin.soe.annotations.States;
import com.apes.framework.util.ApesConst;
import com.apes.scm.masterdata.frame.model.Dept;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;

/**
 * @ClassName : Maintenance
 * @Description : 三方维修单明细
 * @Author : ZhengZeXian
 * @Date: 2020年11月18日14:54:54
 */
@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = MaintenanceItem.CONST_TABLE_NAME)
public class MaintenanceItem extends Model {

    public final static String CONST_TABLE_NAME = "ser_maintenance_item";

    @Id
    @Column(name = "id", nullable = false, length = 24)
    @ApesGenerator(code = CONST_TABLE_NAME, name = "三方维修单明细")
    @Comment("ID")
    private String id;

    @ManyToOne(optional = false)
    @JoinColumn(name = "maintenance_id", referencedColumnName = "id")
    @Comment("三方维修单号")
    private Maintenance maintenance;

    @Comment("商品名称")
    @Column(name = "product_name", length = 400)
    private String productName;

    @Column(name = "quantity", nullable = false, columnDefinition = ApesConst.FIELD_QTY_16_4_0)
    @Comment("数量")
    private double quantity = 0;

    @Comment("销售单价")
    @Column(name = "sale_price", nullable = false, columnDefinition = ApesConst.FIELD_QTY_16_4_0)
    private double salePrice = 0.0;

    @Comment("销售金额")
    @Column(name = "sale_money", nullable = false, columnDefinition = ApesConst.FIELD_QTY_16_4_0)
    private double saleMoney = 0.0;

}
